2020-2021 Sunseeker Telemetry and Lighting System
tlv_ex3_calibrateTempSensor.c File Reference
#include "driverlib.h"

Go to the source code of this file.

Functions

void calibrateADC (void)
 
void main (void)
 
void ADC12ISR (void)
 

Variables

uint16_t temp
 
volatile float DegF
 
volatile float DegC
 
float mref
 
float nref
 
uint8_t bADCCAL_bytes
 
struct s_TLV_ADC_Cal_Data * pADCCAL
 

Function Documentation

◆ ADC12ISR()

void ADC12ISR ( void  )

Definition at line 208 of file tlv_ex3_calibrateTempSensor.c.

References __bic_SR_register_on_exit(), and temp.

◆ calibrateADC()

void calibrateADC ( void  )

Definition at line 127 of file tlv_ex3_calibrateTempSensor.c.

References __delay_cycles(), bADCCAL_bytes, mref, nref, pADCCAL, and param.

Referenced by main().

◆ main()

void main ( void  )

Definition at line 93 of file tlv_ex3_calibrateTempSensor.c.

References __no_operation(), calibrateADC(), DegC, DegF, mref, nref, and temp.

Variable Documentation

◆ bADCCAL_bytes

uint8_t bADCCAL_bytes

Definition at line 78 of file tlv_ex3_calibrateTempSensor.c.

Referenced by calibrateADC().

◆ DegC

volatile float DegC

Definition at line 76 of file tlv_ex3_calibrateTempSensor.c.

Referenced by main().

◆ DegF

volatile float DegF

Definition at line 75 of file tlv_ex3_calibrateTempSensor.c.

Referenced by main().

◆ mref

float mref

Definition at line 77 of file tlv_ex3_calibrateTempSensor.c.

Referenced by calibrateADC(), and main().

◆ nref

float nref

Definition at line 77 of file tlv_ex3_calibrateTempSensor.c.

Referenced by calibrateADC(), and main().

◆ pADCCAL

struct s_TLV_ADC_Cal_Data* pADCCAL

Definition at line 79 of file tlv_ex3_calibrateTempSensor.c.

Referenced by calibrateADC().

◆ temp

uint16_t temp

TLV - Sample Calibrated A10 Internal Temp Sensor as Input, AVcc Ref

After initialization, the the calibration constants for the unit are read in through the TLV. A single sample is made on A10 with reference to internal 1.5V Vref. Software sets ADC12SC to start sample and conversion - ADC12SC automatically cleared at EOC. ADC12 internal oscillator times sample and conversion. In Mainloop MSP430 waits in LPM4 to save power until ADC10 conversion complete, ADC12_A_ISR will force exit from any LPMx in Mainloop on reti.

The results of the temperature sense can be viewed in the watch window by watching the variables DegC and DegF

ACLK = n/a, MCLK = SMCLK = default DCO ~ 1.045MHz, ADC12CLK = ADC12OSC

           MSP430F5438A
        -----------------
    /|\|                 |
     | |                 |
     --|RST              |
       |Temp Sensor-->A10|
       |                 |

This example uses the following peripherals and I/O signals. You must review these and change as needed for your own board:

  • ADC12 peripheral
  • A10

This example uses the following interrupt handlers. To use this example in your own application you must add these interrupt handlers to your vector table.

  • ADC12_A_VECTOR

Definition at line 74 of file tlv_ex3_calibrateTempSensor.c.

Referenced by ADC12ISR(), and main().